package online.xuping.thousandsOfWorlds.sd;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.file.FileAppender;
import cn.hutool.core.io.file.FileReader;
import lombok.SneakyThrows;

import java.util.List;

public class LingPuNvWa extends SdWordsMaker{
    @SneakyThrows
    public static void main(String[] args) {
//        String basePrompt = "1girl,${breasts}, ${hair}, ${hair2}, maid, ((body covered in words,words on body:1.1,tattoos of (words) on body:1.2)),A stunning intricate full color portrait,official art,masterpiece,best quality,unity 8k wallpaper,((photorealistic:1.4)),ultra detailed,(extremely detailed),elegant,beautiful,aesthetic,romanticism,(masterpiece:1.4, best quality),unity 8k wallpaper,ultra detailed,beautiful and aesthetic,detailed,HDR,HD,UHD,64K (HDR,UHD,4K,8K, 64K),beautiful and detailed face,depth of field,portrait,incredibly absurdres,(absurdres:1.2),huge filesize,wallpaper,(teenager:1.3)";
//        String hairs = "white hair | silver hair | grey hair | purple hair | red hair | yellow hair | green hair | blue hair | black hair | brown hair | grey gradient hair | two-tone hair | light brown hair | multicolored hair";
//        String hairs2 = "straight_hair | short hair | curly hair | long hair | pony-tail | bunches | high ponytail | twintails | braided ponytail | ponytail | short ponytail | twin braids | medium hair | very long hair | disheveled hair | wavy hair | hair pink flowers | ahoge | antenna hair | Side ponytail | forehead";
//        String breasts = "small_breasts| medium breasts | big breasts | huge breasts| gigantic breasts";
//        String2File(basePrompt, "hair,hair2,breasts", "C:\\Users\\Administrator\\AppData\\Roaming\\JetBrains\\IntelliJIdea2023.2\\scratches\\魔法内容\\灵仆-1.txt" ,hairs, hairs2, breasts);


        String file2 = "E:\\workspace\\ThousandsOfWorlds\\src\\main\\resources\\config\\words.ini";

        file2List(file2, "C:\\Users\\Administrator\\AppData\\Roaming\\JetBrains\\IntelliJIdea2023.2\\scratches\\魔法内容\\灵仆-3.txt");




    }

    /***
     * 通过配置文件生成
     * @param file
     */
    static public void file2List(String file,String target){

        List<String> re = FileReader.create(FileUtil.file(file)).readLines();
        String basePrompt = re.get(0);
        String header = re.get(1);
        String[] src = new String[re.size()-2];
        if (re.size() > 2) {
            for (int i = 2; i < re.size(); i++) {
                src[i-2] = re.get(i);
            }
        }

        String2File(basePrompt, header, target, src);
    }

   static public List<String> String2List(String template,String header, String... src) {
        return word2ListWithId(template, header, src);
    }

    static public void String2File(String template,String header ,String file, String... src) {
        List<String> get= String2List(template, header, src);
        FileAppender appender = new FileAppender(FileUtil.file(file), 16, true);
        get.stream().forEach(it->appender.append(it));
        appender.flush();
    }
}
